﻿using System;

namespace kunukn.RecommendationEngine.AreaRecommendation.Code.Entities
{
    public class SimilarityResult : Item, IComparable
    {        
        public Item ItemOther { get; set; }
        public double Measure { get; set; }                

        public SimilarityResult(Item item)
        {
            Clone(item);
        }

        public override string ToString()
        {
            if (ItemOther == null)
            {
                return "null";
            }
                
            return string.Format("{0},{1}: {2}", base.Name, ItemOther.Name, Measure);
        }

        public new int CompareTo(object obj)
        {
            return (obj as SimilarityResult) == null ? 1 : this.Measure.CompareTo((obj as SimilarityResult).Measure);
        }
    }
}